#include<iostream>
#include "polynomial.h"
#include "vector"
#include <cmath>  
using namespace std;

class Func1 : public Function {
    public:
        virtual double operator()(const double &x)const {
            return 1.0 / (1.0 + x * x);
        }
}Func1;

int main(){
    Polynomial p_2 = Grid_Interpolation(Func1, -5, 5, 3).getPoly();
    Polynomial p_4 = Grid_Interpolation(Func1, -5, 5, 5).getPoly();
    Polynomial p_6 = Grid_Interpolation(Func1, -5, 5, 7).getPoly();
    Polynomial p_8 = Grid_Interpolation(Func1, -5, 5, 9).getPoly();
    cout << "n = 2: " << p_2 << endl;
    cout << "n = 4: " << p_4 << endl;
    cout << "n = 6: " << p_6 << endl;
    cout << "n = 8: " << p_8 << endl;
    return 0;
}